package co.edu.poli.ficb.agl.automatable.modelo;

/**
 * @author  Diego Satoba
 * @author  Ingrid Baquero 
 * @version  1.1, 03/29/11
 * @since  1.0
 */
public class SimboloImpl implements Simbolo{
	
	// lambda minuscula
	/**
	 * @deprecated usar Simbolos.LAMBDA
	 * @uml.property  name="lAMBDA"
	 * @uml.associationEnd  
	 */
	@Deprecated
	public static SimboloImpl LAMBDA = new SimboloImpl('\u03BB');
	
	/**
	 * @uml.property  name="c"
	 */
	private char c;
	
	public SimboloImpl(char c) {
		this.c = c;
	}

	@Override
	public String toString() {
		return String.valueOf(c);
	}

	@Override
	public int compareTo(Simbolo other) {
		return this.caracter() > other.caracter() ? 1 : (this.caracter() < other.caracter() ? -1 : 0);
	}
	
	@Override
	public boolean equals(Object o) {
		if (o instanceof SimboloImpl) {
			SimboloImpl other = (SimboloImpl) o;
			return this.c == other.c;
		}
		return false;
	}
	
	public char caracter() {
		return c;
	}
	
	@Override
	public Simbolo clone() {
		try {
			return (Simbolo) super.clone();
		} catch (CloneNotSupportedException e) {
			return null;
		}
	}
}
